<template>
    <div class="container">
        <div class="screen" ref="screenEL">
            <div class="top">
                <Top></Top>
            </div>
            <div class="bottom">
                <div class="left">
                    <Tourist class="tourist"></Tourist>
                    <Sex class="sex"></Sex>
                    <Age class="age"></Age>
                </div>
                <div class="center">
                    <Map class="map"></Map>
                    <Line class="line"></Line>
                </div>
                <div class="right">
                    <Year class="year"></Year>
                    <Counter class="counter"> </Counter>
                    <Rank class="rank"></Rank>

                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import Top from '@/views/screen/components/top/index.vue'
import Tourist from '@/views/screen/components/tourist/index.vue'
import Sex from '@/views/screen/components/sex/index.vue'
import Age from '@/views/screen/components/age/index.vue'
import Map from '@/views/screen/components/map/index.vue'
import Line from '@/views/screen/components/line/index.vue'
import Rank from '@screen/rank/index.vue'
import Year from '@screen/year/index.vue'
import Counter from '@screen/counter/index.vue'

const screenEL = ref()
onMounted(() => {
    if (screenEL.value) {
        screenEL.value.style.transform = `scale(${Scale()}) translate(-50%, -50%)`
    }
})
function Scale(w = 1920, h = 1080) {
    const widthScale = window.innerWidth / w
    const heightScale = window.innerHeight / h
    return widthScale < heightScale ? widthScale : heightScale
}
window.addEventListener('resize', () => {
    screenEL.value.style.transform = `scale(${Scale()}) translate(-50%, -50%)`
})


</script>

<style scoped lang="scss">
.container {
    width: 100vw;
    height: 100vh;
    background: url(./images/bg.png) no-repeat;
    background-size: cover;

    .screen {
        position: fixed;
        width: 1920px;
        height: 1080px;
        left: 50%;
        top: 50%;
        transform-origin: left top;

        // background-color: pink;

        .top {
            width: 100%;
            height: 40px;
        }

        .bottom {
            display: flex;
            height: 1040px;

            .left {
                flex: 1;
                display: flex;
                flex-direction: column;
                box-sizing: border-box;
                // background-color: rgb(72, 72, 72);

                .tourist {
                    flex: 1.3;
                }

                .sex {
                    flex: 1;

                }

                .age {
                    flex: 1;
                }
            }

            .center {
                flex: 2;
                display: flex;
                flex-direction: column;

                .map {
                    box-sizing: border-box;
                    // padding: 20px;
                    flex: 4;
                }

                .line {
                    flex: 1.2;
                }
            }

            .right {
                flex: 1;
                display: flex;
                flex-direction: column;
                margin-left: 20px;

                .rank {
                    flex: 1.5;
                }

                .year {
                    flex: 1;

                }

                .counter {
                    flex: 1;
                }
            }


        }
    }
}
</style>